<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 作业
        ;(function(){
            function Car(opt){
                this.pl = opt.pl;
                this.color = opt.color;
                this.brand = opt.brand;
            }
            function Person(opt){
                // Car.apply(this, [opt]);
                Car.call(this, opt);

                this.name = opt.name;
                this.age = opt.age;
                this.desc = function(){
                    console.log(`年龄为${this.age}岁，姓名为${this.name}买了一辆排量为${this.pl}的${this.color}的${this.brand}的车`);
                }
            }
            var person = new Person({
                name: '小明',
                age: 18,
                pl: '2.0',
                color: '红色',
                brand: 'Mazda'
            })

            person.desc();
        })()
    </script>
</body>
</html>